<?php

abstract class Vega_Dao_Table
{
    
    protected $_table = null;
    
    protected $_db = null;
    
    public function __construct(Vega_Db_Abstract $db)
    {
        $this->_db = $db;
        
    }
    
    public function setDb(Vega_Db_Abstract $db)
    {
        $this->_db = $db;
    }
    
    public function insert($data, $multiple = false, $table = '')
    {
    	$target_table = ($table == '')?$this->_table:$table;
        if (!$multiple)
        {
            return $this->_db->insert($target_table, $data);
        }
        $this->_db->multipleInsert($target_table, $data);
    }
    
    public function update($data, $where = '1 = 1', $table = '')
    {
    	$target_table = ($table == '')?$this->_table:$table;
        return $this->_db->update($target_table, $data, $where);
    }
    
    public function delete($where,$table = '')
    {
    	$target_table = ($table == '')?$this->_table:$table;
        return $this->_db->delete($target_table, $where);
    }
    
    public function valueQuote($value)
    {
        return $this->_db->valueQuote($value);
    }
    
    public function fieldQuote($field)
    {
        return $this->_db->fieldQuote($field);
    }
    
    
    public function setMasterMode($bool) {
    	$this->_db->setMasterMode($bool);
    }    
}


